import oracle.jdbc.driver.OracleDriver;
import java.sql.*;
import java.util.Properties;
public class Test {

	public static void main(String[] args)throws Exception {
		Connection connect = null;
        Statement statement = null;
        ResultSet resultSet = null;
        
        Class.forName("oracle.jdbc.OracleDriver");				//引用驱动
        
        connect = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL1", "scott", "zym");
        
        System.out.println(connect);
        
        statement = connect.createStatement();
        
        resultSet = statement.executeQuery("select  * from tb_test");
        
        while (resultSet.next())
        {
            int id = resultSet.getInt("id");
            String name = resultSet.getString("name");
            String city = resultSet.getString("city");
            System.out.println(id+"   "+name+"   "+city);  
        }
        resultSet.close();
        statement.close();
        connect.close();

	}

}
